final class Player extends ObjectInstance {
	int anInt1743;
	int anInt1744;
	int anInt1745;
	Model aModel_1746;
	int prayerIcon = -1;
	long aLong1749 = -1L;
	int anInt1750;
	String aString1751;
	int[] anIntArray1752 = new int[12];
	int anInt1753;
	long aLong1754;
	int anInt1755;
	int skullIcon = -1;
	NpcDefinition aNpcDefinition_1757;
	boolean aBoolean1758 = false;
	int anInt1759;
	int[] anIntArray1760 = new int[5];
	static Cache aCache_1761 = new Cache(260);
	private boolean aBoolean1762 = true;
	boolean aBoolean1763 = false;
	int anInt1764;
	int anInt1765;
	int anInt1766;
	private boolean aBoolean1767 = false;
	int anInt1768;
	int anInt1769;
	int anInt1770;
	int anInt1771;

	public final Model method581(boolean bool) {
		if (!(this).aBoolean1758) {
			return null;
		}
		if ((this).aNpcDefinition_1757 != null) {
			return (this).aNpcDefinition_1757.method370(858);
		}
		boolean bool_0_ = false;
		for (int i = 0; i < 12; i++) {
			int i_1_ = (this).anIntArray1752[i];
			if (i_1_ >= 256 && i_1_ < 512
				&& !IdentityKit.appearances[i_1_ - 256].method449(-10584)) {
				bool_0_ = true;
			}
			if (i_1_ >= 512 && !(ItemDefinition.method212(i_1_ - 512).method211((this).anInt1755, 0))) {
				bool_0_ = true;
			}
		}
		if (bool_0_) {
			return null;
		}
		Model[] class50_sub1_sub4_sub4s = new Model[12];
		int i = 0;
		for (int i_2_ = 0; i_2_ < 12; i_2_++) {
			int i_3_ = (this).anIntArray1752[i_2_];
			if (i_3_ >= 256 && i_3_ < 512) {
				Model model = IdentityKit.appearances[i_3_ - 256]
					.method450();
				if (model != null) {
					class50_sub1_sub4_sub4s[i++] = model;
				}
			}
			if (i_3_ >= 512) {
				Model model = (ItemDefinition.method212(i_3_ - 512)
					.method219((this).anInt1755));
				if (model != null) {
					class50_sub1_sub4_sub4s[i++] = model;
				}
			}
		}
		Model model = new Model(i,
			class50_sub1_sub4_sub4s, (byte) -89);
		if (!bool) {
			throw new NullPointerException();
		}
		for (int i_4_ = 0; i_4_ < 5; i_4_++) {
			if ((this).anIntArray1760[i_4_] != 0) {
				model.method602(Client.anIntArrayArray1008[i_4_][0],
					(Client.anIntArrayArray1008[i_4_][((this).anIntArray1760[i_4_])]));
				if (i_4_ == 1) {
					model.method602(Client.anIntArray1268[0],
						Client.anIntArray1268[(this).anIntArray1760[i_4_]]);
				}
			}
		}
		return model;
	}

	private final Model method582(byte i) {
		if ((this).aNpcDefinition_1757 != null) {
			int i_5_ = -1;
			if (((ObjectInstance) this).anInt1624 >= 0
				&& ((ObjectInstance) this).anInt1627 == 0) {
				i_5_ = (Sequence.sequences[((ObjectInstance) this).anInt1624].anIntArray295[((ObjectInstance) this).anInt1625]);
			} else if (((ObjectInstance) this).anInt1588 >= 0) {
				i_5_ = (Sequence.sequences[((ObjectInstance) this).anInt1588].anIntArray295[((ObjectInstance) this).anInt1589]);
			}
			Model model = (this).aNpcDefinition_1757.method373(i_5_,
				-1, 0, null);
			return model;
		}
		long l = (this).aLong1754;
		int i_6_ = -1;
		int i_7_ = -1;
		int i_8_ = -1;
		int i_9_ = -1;
		if (((ObjectInstance) this).anInt1624 >= 0
			&& ((ObjectInstance) this).anInt1627 == 0) {
			Sequence sequence = (Sequence.sequences[((ObjectInstance) this).anInt1624]);
			i_6_ = (sequence.anIntArray295[((ObjectInstance) this).anInt1625]);
			if (((ObjectInstance) this).anInt1588 >= 0
				&& (((ObjectInstance) this).anInt1588 != ((ObjectInstance) this).anInt1634)) {
				i_7_ = (Sequence.sequences[((ObjectInstance) this).anInt1588].anIntArray295[((ObjectInstance) this).anInt1589]);
			}
			if (sequence.anInt302 >= 0) {
				i_8_ = sequence.anInt302;
				l += (i_8_ - ((this).anIntArray1752[5]) << 8);
			}
			if (sequence.anInt303 >= 0) {
				i_9_ = sequence.anInt303;
				l += (i_9_ - ((this).anIntArray1752[3]) << 16);
			}
		} else if (((ObjectInstance) this).anInt1588 >= 0) {
			i_6_ = (Sequence.sequences[((ObjectInstance) this).anInt1588].anIntArray295[((ObjectInstance) this).anInt1589]);
		}
		Model model = (Model) Player.aCache_1761
			.method345(l);
		if (model == null) {
			boolean bool = false;
			for (int i_10_ = 0; i_10_ < 12; i_10_++) {
				int i_11_ = ((this).anIntArray1752[i_10_]);
				if (i_9_ >= 0 && i_10_ == 3) {
					i_11_ = i_9_;
				}
				if (i_8_ >= 0 && i_10_ == 5) {
					i_11_ = i_8_;
				}
				if (i_11_ >= 256 && i_11_ < 512
					&& !IdentityKit.appearances[i_11_ - 256].method447(256)) {
					bool = true;
				}
				if (i_11_ >= 512
					&& !(ItemDefinition.method212(i_11_ - 512).method216(-861, (this).anInt1755))) {
					bool = true;
				}
			}
			if (bool) {
				if ((this).aLong1749 != -1L) {
					model = ((Model) (Player.aCache_1761
						.method345((this).aLong1749)));
				}
				if (model == null) {
					return null;
				}
			}
		}
		if (model == null) {
			Model[] class50_sub1_sub4_sub4s = new Model[12];
			int i_12_ = 0;
			for (int i_13_ = 0; i_13_ < 12; i_13_++) {
				int i_14_ = ((this).anIntArray1752[i_13_]);
				if (i_9_ >= 0 && i_13_ == 3) {
					i_14_ = i_9_;
				}
				if (i_8_ >= 0 && i_13_ == 5) {
					i_14_ = i_8_;
				}
				if (i_14_ >= 256 && i_14_ < 512) {
					Model model_15_ = IdentityKit.appearances[i_14_ - 256]
						.method448((byte) 2);
					if (model_15_ != null) {
						class50_sub1_sub4_sub4s[i_12_++] = model_15_;
					}
				}
				if (i_14_ >= 512) {
					Model model_16_ = (ItemDefinition
						.method212(i_14_ - 512).method213((byte) -98, (this).anInt1755));
					if (model_16_ != null) {
						class50_sub1_sub4_sub4s[i_12_++] = model_16_;
					}
				}
			}
			model = new Model(i_12_, class50_sub1_sub4_sub4s,
				(byte) -89);
			for (int i_17_ = 0; i_17_ < 5; i_17_++) {
				if ((this).anIntArray1760[i_17_] != 0) {
					model.method602(Client.anIntArrayArray1008[i_17_][0],
						(Client.anIntArrayArray1008[i_17_][((this).anIntArray1760[i_17_])]));
					if (i_17_ == 1) {
						model.method602(Client.anIntArray1268[0],
							(Client.anIntArray1268[((this).anIntArray1760[i_17_])]));
					}
				}
			}
			model.method595(7);
			model.preProcess(64, 850, -30, -50, -30, true);
			Player.aCache_1761.method346(model, l);
			(this).aLong1749 = l;
		}
		if ((this).aBoolean1763) {
			return model;
		}
		Model model_18_ = Model.aModel_1643;
		model_18_.method590(
			(Class21.method239(i_6_) & Class21.method239(i_7_)),
			model, 1244);
		if (i_6_ != -1 && i_7_ != -1) {
			model_18_
				.method597(
					i_7_,
					0,
					i_6_,
					(Sequence.sequences[((ObjectInstance) this).anInt1624].anIntArray299));
		} else if (i_6_ != -1) {
			model_18_.method596(i_6_, (byte) 6);
		}
		model_18_.method592();
		model_18_.anIntArrayArray1679 = null;
		model_18_.anIntArrayArray1678 = null;
		return model_18_;
	}

	@Override
	public final boolean method576(int i) {
		if (i != 0) {
			for (int i_19_ = 1; i_19_ > 0; i_19_++) {
				/* empty */
			}
		}
		if (!(this).aBoolean1758) {
			return false;
		}
		return true;
	}

	@Override
	public final Model method572(byte i) {
		if (!(this).aBoolean1758) {
			return null;
		}
		Model model = method582((byte) 122);
		if (model == null) {
			return null;
		}
		((ObjectInstance) this).height = model.anInt1475;
		model.aBoolean1680 = true;
		if ((this).aBoolean1763) {
			return model;
		}
		if (((ObjectInstance) this).anInt1614 != -1
			&& ((ObjectInstance) this).anInt1615 != -1) {
			SpotAnimation spotAnimation = (SpotAnimation.spotAnims[((ObjectInstance) this).anInt1614]);
			Model model_20_ = spotAnimation.method307();
			if (model_20_ != null) {
				Model model_21_ = (new Model(
					false, false, true, model_20_, Class21.method239((((ObjectInstance) this).anInt1615))));
				model_21_.method601(0, 0, false,
					-((ObjectInstance) this).anInt1618);
				model_21_.method595(7);
				model_21_
					.method596(
						(spotAnimation.sequence.anIntArray295[((ObjectInstance) this).anInt1615]),
						(byte) 6);
				model_21_.anIntArrayArray1679 = null;
				model_21_.anIntArrayArray1678 = null;
				if (spotAnimation.anInt561 != 128 || spotAnimation.anInt562 != 128) {
					model_21_.method604(spotAnimation.anInt562, spotAnimation.anInt561, 9,
						spotAnimation.anInt561);
				}
				model_21_.preProcess(spotAnimation.anInt564 + 64, spotAnimation.anInt565 + 850,
					-30, -50, -30, true);
				Model[] class50_sub1_sub4_sub4s = { model,
					model_21_ };
				model = new Model(2, true, 0,
					class50_sub1_sub4_sub4s);
			}
		}
		if ((this).aModel_1746 != null) {
			if (Client.anInt1325 >= (this).anInt1765) {
				(this).aModel_1746 = null;
			}
			if ((Client.anInt1325 >= (this).anInt1764) && (Client.anInt1325 < (this).anInt1765)) {
				Model model_22_ = ((this).aModel_1746);
				model_22_.method601(
					((this).anInt1743 - ((ObjectInstance) this).anInt1610),
					((this).anInt1745 - ((ObjectInstance) this).anInt1611), false,
					((this).anInt1744 - (this).anInt1750));
				if (((ObjectInstance) this).anInt1584 == 512) {
					model_22_.method599(true);
					model_22_.method599(true);
					model_22_.method599(true);
				} else if (((ObjectInstance) this).anInt1584 == 1024) {
					model_22_.method599(true);
					model_22_.method599(true);
				} else if (((ObjectInstance) this).anInt1584 == 1536) {
					model_22_.method599(true);
				}
				Model[] class50_sub1_sub4_sub4s = { model,
					model_22_ };
				model = new Model(2, true, 0,
					class50_sub1_sub4_sub4s);
				if (((ObjectInstance) this).anInt1584 == 512) {
					model_22_.method599(true);
				} else if (((ObjectInstance) this).anInt1584 == 1024) {
					model_22_.method599(true);
					model_22_.method599(true);
				} else if (((ObjectInstance) this).anInt1584 == 1536) {
					model_22_.method599(true);
					model_22_.method599(true);
					model_22_.method599(true);
				}
				model_22_.method601(
					(((ObjectInstance) this).anInt1610 - (this).anInt1743),
					(((ObjectInstance) this).anInt1611 - (this).anInt1745), false,
					((this).anInt1750 - (this).anInt1744));
			}
		}
		model.aBoolean1680 = true;
		if (i == 3) {
		} else {
			aBoolean1767 = !aBoolean1767;
		}
		return model;
	}

	public final void method583(Packet packet, int i) {
		packet.offset = 0;
		(this).anInt1755 = packet.getUByte();
		(this).skullIcon = packet.getByte();
		(this).prayerIcon = packet.getByte();
		(this).aNpcDefinition_1757 = null;
		(this).anInt1766 = 0;
		for (int i_23_ = 0; i_23_ < 12; i_23_++) {
			int i_24_ = packet.getUByte();
			if (i_24_ == 0) {
				(this).anIntArray1752[i_23_] = 0;
			} else {
				int i_25_ = packet.getUByte();
				(this).anIntArray1752[i_23_] = (i_24_ << 8) + i_25_;
				if (i_23_ == 0 && ((this).anIntArray1752[0] == 65535)) {
					(this).aNpcDefinition_1757 = NpcDefinition.method375(packet.getUShort());
					break;
				}
				if (((this).anIntArray1752[i_23_] >= 512)
					&& ((this).anIntArray1752[i_23_]) - 512 < ItemDefinition.anInt335) {
					int i_26_ = (ItemDefinition.method212(((this).anIntArray1752[i_23_]) - 512).anInt332);
					if (i_26_ != 0) {
						(this).anInt1766 = i_26_;
					}
				}
			}
		}
		for (int i_27_ = 0; i_27_ < 5; i_27_++) {
			int i_28_ = packet.getUByte();
			if (i_28_ < 0 || i_28_ >= Client.anIntArrayArray1008[i_27_].length) {
				i_28_ = 0;
			}
			(this).anIntArray1760[i_27_] = i_28_;
		}
		((ObjectInstance) this).anInt1634 = packet.getUShort();
		if (((ObjectInstance) this).anInt1634 == 65535) {
			((ObjectInstance) this).anInt1634 = -1;
		}
		((ObjectInstance) this).anInt1635 = packet.getUShort();
		if (((ObjectInstance) this).anInt1635 == 65535) {
			((ObjectInstance) this).anInt1635 = -1;
		}
		((ObjectInstance) this).anInt1619 = packet.getUShort();
		if (((ObjectInstance) this).anInt1619 == 65535) {
			((ObjectInstance) this).anInt1619 = -1;
		}
		((ObjectInstance) this).anInt1620 = packet.getUShort();
		if (((ObjectInstance) this).anInt1620 == 65535) {
			((ObjectInstance) this).anInt1620 = -1;
		}
		((ObjectInstance) this).anInt1621 = packet.getUShort();
		if (((ObjectInstance) this).anInt1621 == 65535) {
			((ObjectInstance) this).anInt1621 = -1;
		}
		((ObjectInstance) this).anInt1622 = packet.getUShort();
		if (((ObjectInstance) this).anInt1622 == 65535) {
			((ObjectInstance) this).anInt1622 = -1;
		}
		((ObjectInstance) this).anInt1629 = packet.getUShort();
		if (((ObjectInstance) this).anInt1629 == 65535) {
			((ObjectInstance) this).anInt1629 = -1;
		}
		(this).aString1751 = TextUtil.method303(
			TextUtil.method300(packet.getLong(), 0));
		(this).anInt1753 = packet.getUByte();
		(this).anInt1759 = packet.getUShort();
		(this).aBoolean1758 = true;
		(this).aLong1754 = 0L;
		int i_29_ = (this).anIntArray1752[5];
		int i_30_ = (this).anIntArray1752[9];
		if (i == 0) {
			(this).anIntArray1752[5] = i_30_;
			(this).anIntArray1752[9] = i_29_;
			for (int i_31_ = 0; i_31_ < 12; i_31_++) {
				(this).aLong1754 <<= 4;
				if ((this).anIntArray1752[i_31_] >= 256) {
					(this).aLong1754 += (((this).anIntArray1752[i_31_]) - 256);
				}
			}
			if ((this).anIntArray1752[0] >= 256) {
				(this).aLong1754 += (((this).anIntArray1752[0]) - 256 >> 4);
			}
			if ((this).anIntArray1752[1] >= 256) {
				(this).aLong1754 += (((this).anIntArray1752[1]) - 256 >> 8);
			}
			(this).anIntArray1752[5] = i_29_;
			(this).anIntArray1752[9] = i_30_;
			for (int i_32_ = 0; i_32_ < 5; i_32_++) {
				(this).aLong1754 <<= 3;
				(this).aLong1754 += ((this).anIntArray1760[i_32_]);
			}
			(this).aLong1754 <<= 1;
			(this).aLong1754 += (this).anInt1755;
		}
	}
}
